package com.becca.cake.dao.voucher;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Repository;

import com.becca.cake.model.logistic.LogisticStatusModel;
import com.becca.cake.model.voucher.VoucherAdvertModel;
import com.becca.cake.model.voucher.VoucherModel;
import com.becca.cake.model.voucher.VoucherOrderDetailsModel;
import com.becca.cake.model.voucher.VoucherOrderExcelModel;
import com.becca.cake.model.voucher.VoucherOrderModel;
import com.becca.cake.model.voucher.VoucherUserPaymentsModel;

/**
 * 抵用券管理Dao层接口
 * @copyright  尊星(上海)信息科技有限公司
 * @author mouwanming
 * @date 2016年9月6日 14:45:10
 */
@Repository
public interface VoucherDao {
	
	/**
     * 查询所有抵用券
     * @param map
     * @return
     * @throws DataAccessException
     */
	List<VoucherModel> selectVoucher(Map<String, Object> map) throws DataAccessException; 
	
	/**
     * 
     * 获取抵用券数据总条数
     * @param map
     * @return
     * @throws DataAccessException
     */
    Long selectVoucherCount(Map<String, Object> map) throws DataAccessException;
    
    /**
     * 添加抵用券信息
     * @param voucherModel
     * @throws DataAccessException
     */
    void insertVoucher(VoucherModel voucherModel) throws DataAccessException;
    
    /**
     * 修改抵用券信息
     * @param voucherModel
     * @throws DataAccessException
     */
    void updateVoucher(VoucherModel voucherModel) throws DataAccessException;
    
    /**
     * 下架抵用券
     * @param id
     * @throws DataAccessException
     */
    void updVoucherStatusById(Map<String, Object> map) throws DataAccessException;
    
    /**
     * 根据抵用券编号查找抵用券对象
     * @param voucherId
     * @return
     * @throws DataAccessException
     */
    VoucherModel selectVoucherById(Integer voucherId) throws DataAccessException;
    
    /**
     * 根据Id修改状态 
     * @param map
     * @throws DataAccessException
     */
    void updIsDelete(Map<String, Object> map) throws DataAccessException;
    
    
    /**
     * 查询抵用券订单数据
     * @param map
     * @return
     * @throws DataAccessException
     */
    List<VoucherOrderModel> selectVoucherOrder(Map<String, Object> map) throws DataAccessException;
    
    /**
     * 查询抵用券订单总记录数
     * @param map
     * @return
     * @throws DataAccessException
     */
    Long selectVoucherOrderCount(Map<String, Object> map) throws DataAccessException;
    
    /**
     * 修订订单信息
     * @param voucherOrderModel
     * @throws DataAccessException
     */
     void updateVoucherOrderModel(VoucherOrderModel voucherOrderModel) throws DataAccessException;
     
     /**
      * 根据orderId获取对应订单对象
      * @param orderId
      * @return
      * @throws DataAccessException
      */
     VoucherOrderModel findVoucherOrderById(Integer orderId) throws DataAccessException;
     
     /**
      * 跟据订单号查询订单详情
      * @param orderId
      * @return
      * @throws DataAccessException
      */
     List<VoucherOrderDetailsModel> selectDetailsByOrderId(Integer orderId) throws DataAccessException;
     
     /**
      * 根据ID查询订单信息
      * @param orderId
      * @return
      * @throws DataAccessException
      */
     VoucherOrderModel selectOrderById(Integer orderId) throws DataAccessException;
     
     /**
      * 修改订单状态信息
      * @param voucherOrderModel
      * @throws DataAccessException
      */
     void updateOrderStatus(VoucherOrderModel voucherOrderModel) throws DataAccessException;
     
     /**
      * 添加支付流水记录
      * @param voucherUserPaymentsModel
      */
     int addVoucherUserPayments(VoucherUserPaymentsModel voucherUserPaymentsModel);
     
     /**
      * 设置订单编码
      * @param paramMap
      * @throws DataAccessException
      */
     void updateOrderCode(Map<String, Object> paramMap) throws DataAccessException;
     
     /**
      * 新建订单详情对象
      * @param voucherorderDetailsModel
      * @throws DataAccessException
      */
     void insertVoucherOrderDetail(VoucherOrderDetailsModel voucherorderDetailsModel) throws DataAccessException;
     
     /**
      * 新建订单对象
      * @param voucherOrderModel
      * @throws DataAccessException
      */
     void insertVoucherOrder(VoucherOrderModel voucherOrderModel) throws DataAccessException;
     
     /**
      * 每天的订单明细
      * @param preDayTime
      * @param nowDayTime
      * @return
      * @throws DataAccessException
      */
     List<VoucherOrderModel> selectDayOrders(Map<String, Object> paramMap) throws DataAccessException;

     /**
      * 交接单打印：查询交接订单列表
      * @param orderIds
      * @return
      * @throws DataAccessException
      */
     List<VoucherOrderModel> selectHandOverOrders(@Param("orderIds") String orderIds);
     
     /**
      * 交接单打印：查询交接详情列表
      * @return
      * @throws DataAccessException
      */
     List<VoucherOrderDetailsModel> selectHandOverOrderDetails(Integer orderId) throws DataAccessException;

     
     /**
      * 添加物流信息
      * @param logisticStatusModel
      * @throws DataAccessException
      */
     void addLogisticStatus(LogisticStatusModel logisticStatusModel) throws DataAccessException;
     
     /**
      * 查询打印的订单信息
      * @param map
      * @return
      * @throws DataAccessException
      */
     List<VoucherOrderModel> selectPrintThermalOrder(Map<String, Object> map) throws DataAccessException;

     /**
      * 查询热敏打印商品详情信息
      * @param map
      * @return
      * @throws DataAccessException
      */
     List<VoucherOrderDetailsModel> selectOrderDetailByOrderId(Map<String, Object> map);
     
     /**
      * 订单详情 ：导出excel
      * 
      * @param orderId
      * @return
      * @throws DataAccessException
      */
     List<VoucherOrderExcelModel> selectOrderExcelModel(@Param("orderIds") String orderIds)
                                                                                    throws DataAccessException;
     /**
      * 修改物流信息
      * @param map
      * @throws DataAccessException
      */
     void updateOrderLogisticsMessage(Map<String, Object> map) throws DataAccessException;

     /**
      * 抵用券广告查询
      * @param map
      * @return
      * @throws DataAccessException
      */
     List<VoucherAdvertModel> selectVoucherAdverts(Map<String, Object> map) throws DataAccessException;
     
     /**
      * 获取查询抵用券广告数据列表总条数
      * @param map
      * @return
      * @throws DataAccessException
      */
     Long selectVoucherAdvertsCount(Map<String, Object> map) throws DataAccessException;

     /**
      * 添加广告信息
      * @param voucherAdvertModel
      * @throws DataAccessException
      */
     void insertVoucherAdvert(VoucherAdvertModel voucherAdvertModel) throws DataAccessException;

     /**
      * 添加确认发货图片
      * @param voucherOrderModel
      * @throws DataAccessException
      */
     void insertVoucherOrderPicture(VoucherOrderModel voucherOrderModel) throws DataAccessException;

     
     /**
      * 修改抵用券广告信息
      * @param voucherAdvertModel
      * @throws DataAccessException
      */
     void updateVoucherAdvert(VoucherAdvertModel voucherAdvertModel) throws DataAccessException;
     
     /**
      * 根据id查询广告对象
      * @param voucherAdvertId
      * @return
      * @throws DataAccessException
      */
     VoucherAdvertModel selectVoucherAdvertById(Integer voucherAdvertId) throws DataAccessException;
     
     /**
      * 批量修改排序广告
      * @param map
      * @throws DataAccessException
      */
      void updateVoucherOrders (List<VoucherAdvertModel> list) throws DataAccessException;
      
      /**
       * 抵用券排序修改
       * @param list
       */
      void updateVoucherOrder(Map<String, Object> paramMap);
     
    /**
     * 禁用或启用抵用券广告
     * @param map
     * @throws DataAccessException
     */
     void updateAdvStatusById (Map<String, Object> map) throws DataAccessException;
     
     /**
      * 查询抵用券支付流水列表数据
      * @param map
      * @return
      * @throws DataAccessException
      */
     List<VoucherUserPaymentsModel> selectVoucherPayments(Map<String, Object> map) throws DataAccessException;
     
     
     /**
      * 获取抵用券支付流水总条数
      * @param map
      * @return
      * @throws DataAccessException
      */
     Long selectVoucherPaymentsCount(Map<String, Object> map) throws DataAccessException;
     
     /**
      * 验证该抵用券是否 未上架、已上架、已下架
      * @param map
      * @return
      * @throws DataAccessException
      */
     Long isVoucherExist(Map<String, Object> map) throws DataAccessException;
     

}
